var tables=new Array();

{foreach from=$tables item=tn name=ind}
var {$tn->tableName}_columns=new Array();

{foreach from=$tn->columns item=co name=coname}
{$tn->tableName}_columns[{$smarty.foreach.coname.index}]=new Array('{$co->Field}','{$co->Field}');


{/foreach}
tables['{$tn->tableName}']={$tn->tableName}_columns;

{/foreach}
      
        

function test(){

	return false;

}
function   CheckForm()
{ 
	var aliasNames=new Array();


	
	//{foreach from=$tempTables item=ttt name=foo}
	
	aliasNames[{$smarty.foreach.foo.index}]= document.forms[0].aliasName{$smarty.foreach.foo.index}.value;
	//alert(aliasNames[{$smarty.foreach.foo.index}]);

	
	// {/foreach}
	
	
	var to={$tableSize};
	for(var i1=0;i1<to;i1++){

		for(var i2=0;i2<to;i2++){

			if(i2==i1)
			{

				continue;
			}
			if(aliasNames[i1]==aliasNames[i2]){

				var mess=new String("find alias name ["+aliasNames[i1]+"] are duplicated!");

				
				alert(mess);

				return false;
			}
		}
	}

}
function MM_callJS(jsStr) { //v2.0
  return eval(jsStr)

}

function updateTable(targetName,newTable) { 
	
	var columnObj=document.getElementById(targetName);


	if(columnObj==null){

		alert('debug:error target name:'+targetName);

		return;
	}
	
	
	// clear all old value
	for(var i=0;i<columnObj.options.length;i++){

		columnObj.options[i]=null;
	}

	var newColumns=tables[newTable];
	if(newColumns==null){

		alert('debug:error set name:'+newTable);

		return;
	}
	
	for(var i=0;i<newColumns.length;i++){

		columnObj.options[i]=new Option(newColumns[i][0],newColumns[i][1]);

	}
	
  	
  

}